<?php
// +----------------------------------------------------------------------
// | Created by PHPstorm: [ JRK丶Admin ]
// +----------------------------------------------------------------------
// | Copyright (c) 2019~2022 [Conqweal] All rights reserved.
// +----------------------------------------------------------------------
// | SiteUrl: http://www.Conqweal.cn
// +----------------------------------------------------------------------
// | Author: Conqweal <jackhhy520@qq.com>
// +----------------------------------------------------------------------
// | Date: 2020/8/4 0004
// +----------------------------------------------------------------------
// | Description:
// +----------------------------------------------------------------------
namespace app\api\event; 
use support\Request;
use app\api\library\Emailx;
class Emailcaptcha
{
    public function send($data)
    {
        $request = request();

            $lang_id = 1;
            $tpl     = file_get_contents(public_path().'/emailcaptcha/email' . $lang_id.'.html');           
           
            $obj = Emailx::instance();
         
            $df  = [
                'resetpwd' => __("email_fetch_password"),
                'authen'   => __("email_authen"),
            ];
             
            $result=[];
            $result[0] = $obj
                ->to($data->email)
                ->subject(__('email_resetpwd_title'))
                ->message(str_replace(['__code__', '__company__', '__type__'], [$data->code, __("email_company"), $df[$data->event]], $tpl))
                ->send();
       
            $result[1] = $obj->getError();
           
            return $result;
    }

}
